package com.guldan.jaina.common.task;

import com.guldan.core.redis.CacheService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * Created by Silas.
 * Date: 2016/12/21
 * Time: 21:31
 */
public abstract class BaseTask {
    protected Logger logger = LoggerFactory.getLogger(this.getClass());
    @Value("${environment}")
    private String environment;

    @Autowired
    private ThreadPoolTaskExecutor threadPool;

    @Autowired
    public CacheService cacheService;

    public BaseTask() {
    }

    public abstract void execute() throws Exception;

    public void setThreadPool(ThreadPoolTaskExecutor threadPool) {
        this.threadPool = threadPool;
    }

    public String getEnvironment() {
        return this.environment;
    }
}
